<?php
?>
<h3 class="title-popup">Form <?php echo ($kode == "" ? "Tambah" : "Ubah"); ?> Data Divisi</h3>

<form action="<?php echo ($kode == "" ? "divisi_edit" : ""); ?>" method="post" onsubmit="return save()" enctype="multipart/form-data">
          <?php
          if ($msg != "") {
              ?>
        <div class="BoxMessage Warning">Proses Gagal, <br /><?php echo $msg; ?></div>
        <?php
    }
    ?>

    <fieldset class="fldInput">

        <dl>
            <dt class="mandatory">Id Divisi</dt>
            <dd><input class="read-only" type="text" <?php echo ($kode == "" ? "" : 'readonly="readonly" class="read-only" '); ?> name="id_divisi" id="id_divisi" value="<?php echo $id_divisi; ?>" maxlength="40" size="30" /></dd>

            <dt class="mandatory">Nama Divisi</dt>
            <dd>
                <input type="text" name="divisi" id="divisi" value="<?php echo $divisi; ?>" maxlength="40" size="50"   />
                
            </dd>

            <dt class="mandatory">Inisial </dt>
            <dd>
                <input  type="text" name="divisi_sname" id="divisi_sname" value="<?php echo $divisi_sname; ?>" maxlength="40" size="50"  />
                

            </dd>
            <dt>&nbsp;</dt>
            <dd>
                <ul id="note">
                    <li>Field dengan remark harus diisi.</li>
                    <li>Gunakan tombol Cari untuk field dengan property read-only.</li>
                </ul>

            </dd>

        </dl>
    </fieldset>
    <div id="box-control-save">
        <input type="hidden" name="vSave" id="vSave" value="1" />
        <input type="hidden" name="kode" id="kode" value="<?php echo $kode ?>" />
        <input type="hidden" name="vMode" value="<?php echo ($kode == "" ? "add" : "edit"); ?>" />
        <input type="submit" class="CommandButton" name="btnSimpan" value="Save" />&nbsp;
        <input type="button" class="CommandButton" value="Cancel" onclick="javascript:closeGB_();"/>
    </div>
</form>
<script type="text/javascript">
    /*window.parent.parent.GB_hide();window.parent.parent.location.reload()*/
    function closeGB_ (){
<?php echo CloseGB(true); ?>
    }	
    function save() {
        var divisi = document.getElementById("divisi");
        var divisi_sname = document.getElementById("divisi_sname");

        if(trimValue(divisi.value) == '') {
            alert('Parameter Divisi tidak ditemukan!');
        }else if(divisi_sname.value == ''){
            alert('Parameter Inisial tidak ditemukan!');
        }else{
            return true;
        }

        return false;
    }

    function trimValue(str){
        var out = "";
        out = str.replace(/^\s+|\s+$/g,"");
        return out;
    }

    function _obj_fSendValue(kode, nama, elmKode, elmNama) {
        var elmk = document.getElementById("" + elmKode + "");
        var elmn = document.getElementById("" + elmNama + "");
        try {
            elmk.value = kode;
            elmn.value = nama;
        }
        catch(e) {
            alert(e.message);
        }
    }



</script>
